/*
 * Copyright (c) 2025 CAX Conversion Project
 */
package com.comac.ins.cax.utils;

import java.io.IOException;

/**
 * @author yk
 * @desc Execute system command class
 * @date 2024-06-18 17:09
 */
public class ExecUtils {

    public static void exec(String[] cmd, String logUrl) throws IOException, InterruptedException {
        Process exec = Runtime.getRuntime().exec(cmd);
        StreamGobbler errorGobbler = new StreamGobbler(exec.getErrorStream(), "ERROR", logUrl);
        errorGobbler.start();
        StreamGobbler outGobbler2 = new StreamGobbler(exec.getInputStream(), "STDOUT", logUrl);
        outGobbler2.start();
        exec.waitFor();
    }
}
